﻿#include "LeftWidget.h"
#include<qlayout.h>
#include<qlabel.h>
#include<qicon.h>

LeftWidget::LeftWidget(const QIcon& icon, const QString& text, QWidget* parent )
	: QWidget(parent)
{

	this->setMinimumSize(150, 45);
	QHBoxLayout* horizantalLayout = new QHBoxLayout(this);
	m_lbIcon = new QLabel(this);
	const QPixmap& pix = icon.pixmap(20, 20);
	QSize size = this->sizeHint();

	m_lbIcon->setPixmap(pix);
	m_lbIcon->setFixedSize(size);
	

	m_lbText = new QLabel(text, this);

	QFont font = m_lbText->font();
	font.setPointSize(14);
	font.setFamily("新宋体");
	m_lbText->setFont(font);

	

	horizantalLayout->addWidget(m_lbIcon);
	horizantalLayout->addWidget(m_lbText);

	qDebug() << "LeftWidget的sizeHint = " << this->sizeHint();
	qDebug() << "m_lbIcon的建议大小 = " << m_lbIcon->sizeHint();
	qDebug() << "m_lbText的建议大小 = " << m_lbText->sizeHint();
}

LeftWidget::~LeftWidget()
{}
